<%@ page import="com.interfaces.*"%>
<%@ page import="java.util.Random" %>
<%@ page import="com.core.sysDict.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page import="com.core.sysDict.SysDictJsp" %>
<!DOCTYPE html>
<!--
This is a starter template page. Use this page to start your new project from
scratch. This page gets rid of all links and provides the needed markup only.
-->
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>签证信息</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">

    <%
        String path = request.getContextPath();
        path = "/".equals(path)?"":path;
        request.setAttribute("path", path);
        String sysDictJson=SysDictJsp.getSysDictJson(session);
    %>
    <script type="text/javascript">
        var path = "${path}";
    </script>

    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="${path}/public/adminlte/bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="${path}/public/font-awesome-4.7.0/css/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="${path}/public/ionicons/ionicons.min.css">
    <!-- DataTables -->
    <link rel="stylesheet" href="${path}/public/adminlte/plugins/datatables/dataTables.bootstrap.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="${path}/public/adminlte/dist/css/AdminLTE.min.css">
    <!-- AdminLTE Skins. We have chosen the skin-blue for this starter
          page. However, you can choose any other skin. Make sure you
          apply the skin class to the body tag so the changes take effect.
    -->
    <link rel="stylesheet" href="${path}/public/adminlte/dist/css/skins/_all-skins.min.css">
	    <!-- bootstrap datepicker -->
    <link rel="stylesheet" href="${path}/public/adminlte/plugins/datepicker/datepicker3.css">
    <link rel="stylesheet" href="${path}/css/common.css">
    <link rel="stylesheet" href="${path}/public/morris/morris.css">
    <!-- morris -->
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<!--
BODY TAG OPTIONS:
=================
Apply one or more of the following classes to get the
desired effect
|---------------------------------------------------------|
| SKINS         | skin-blue                               |
|               | skin-black                              |
|               | skin-purple                             |
|               | skin-yellow                             |
|               | skin-red                                |
|               | skin-green                              |
|---------------------------------------------------------|
|LAYOUT OPTIONS | fixed                                   |
|               | layout-boxed                            |
|               | layout-top-nav                          |
|               | sidebar-collapse                        |
|               | sidebar-mini                            |
|---------------------------------------------------------|
-->
<body >
<div class="container">
            <div class="box box-primary">
                	<div class="nav-tabs-custom">
           			 <!-- Tabs within a box -->
            			<ul class="nav nav-tabs pull-right">
              				<li class="pull-left header"><i class="fa fa-inbox"></i>月报</li>
              				<li class="pull-right header col-md-3">
              				<div class="input-group">
                				<input id="monthValue" type="text" class="form-control">
                				<div class="input-group-btn">
                  					<button id="searchMonth" type="button" class="btn btn-primary btn-flat">查看</button>
                				</div>
                				<!-- /btn-group -->
              				</div>
              				</li>
            			</ul>
            			<div class="tab-content no-padding">
              				<!-- Morris chart - Sales -->
              				<div class="chart tab-pane active" id="monthTable" style="position: relative; height: 200px;"></div>
                		</div><!-- tab-content -->
                	</div><!-- nav-tabs-custom -->
          	</div><!--box box-primary -->
          	<div class="box box-primary">
          		<div class="nav-tabs-custom">
           			 <!-- Tabs within a box -->
            			<ul class="nav nav-tabs pull-right">
              				<li class="pull-left header"><i class="fa fa-inbox"></i>详情统计表</li>
            			</ul>
            				<div class="input-group input-daterange col-md-4 pull-right">
    							<input type="text" id="startDate" class="form-control">
    							<div class="input-group-addon">to</div>
    							<input type="text" id="endDate" class="form-control">
    							<div class="input-group-btn">
                  					<button id="searchRangeDays" type="button" class="btn btn-primary btn-flat">查看</button>
                				</div>
							</div>
            			
            			<div class="tab-content no-padding">
							<table id="dg" class="table table-bordered table-hover"></table>
                		</div><!-- tab-content -->
                	</div><!-- nav-tabs-custom -->
			</div>
<!-- ./wrapper -->

<div class="modal fade" id="modelContainer" role="basic" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
        </div>
    </div>
</div>

<!-- REQUIRED JS SCRIPTS -->

<!-- jQuery 2.2.3 -->
<script src="${path}/public/adminlte/plugins/jQuery/jquery-2.2.3.min.js"></script>
<!-- Bootstrap 3.3.6 -->
<script src="${path}/public/adminlte/bootstrap/js/bootstrap.min.js"></script>
<!-- DataTables -->
<script src="${path}/public/adminlte/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="${path}/public/adminlte/plugins/datatables/dataTables.bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="${path}/public/adminlte/plugins/slimScroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="${path}/public/adminlte/plugins/fastclick/fastclick.js"></script>
<!-- AdminLTE App -->
<script src="${path}/public/adminlte/dist/js/app.min.js"></script>
<!-- 字典-->
<script src="${path}/js/sysDict.js"></script>
<!-- Morris -->
<script src="${path}/public/morris/morris.min.js"></script>
<script src="${path}/public/morris/raphael-min.js"></script>
<!-- bootstrap datepicker -->
<script src="${path}/public/adminlte/plugins/datepicker/bootstrap-datepicker.js"></script>
<!-- Optionally, you can add Slimscroll and FastClick plugins.
     Both of these plugins are recommended to enhance the
     user experience. Slimscroll is required when using the
     fixed layout. -->
<!-- page script -->
<script>
	var table;
	var url = window.location.search;
	var arr=url.split('&');
	var curid = "tab_"+arr[arr.length-2];
	var sysDict='<%=sysDictJson %>';
	var re = JSON.parse(sysDict);
	var searchDay; 
	(function($){
	$.fn.datepicker.dates['zh-CN'] = {
		days: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
		daysShort: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
		daysMin:  ["日", "一", "二", "三", "四", "五", "六"],
		months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
		monthsShort: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"],
		today: "今日",
		clear: "清除",
		format: "yyyy年mm月dd日",
		titleFormat: "yyyy年mm月",
		weekStart: 1
	};
}(jQuery));
	$('.input-daterange input').each(function() {
	autoclose: true,
    $(this).datepicker({
    language:'zh-CN',
    format: 'yyyy-mm-dd',
    });
});
	var graph= Morris.Line({
                	  element: 'monthTable',
                	  data: searchDay,
                	  xkey:'day' ,
                      ykeys: ['usefulValue'],
                      labels: ['数量'],
                      parseTime:false,
                      hideHover:true,
            });
	window.onload=function(){
    $('#monthValue').datepicker({
            format: 'yyyy-mm',
            autoclose: true
        });
    init();
     $(document).ready(function() {
    	getmonthData();
    }); 
    
    $("#checkAll").click(function () {
      var check = $(this).prop("checked");
      $(".checkchild").prop("checked", check);
		});
	
    };	
    function getmonthData(){
    	searchDay = $('#monthValue').val();
    	console.info(searchDay);
    	var monthData;
    	$.ajax({  
            	type:"POST",  
               	url:"${path}<%=StatisticaController.URL_SEARCH%>",  
                data:{"searchDay":searchDay}, 
                dataType:'json',   
                success:function(result){  
                	  monthData=result;
                	  graph.setData(monthData);
                   },  
           		error:function(request) {      // 设置表单提交出错
                	alert(request);  //登录错误提示信息
            	}
          	});  
    }
	function init() {
        table=$('#dg').DataTable({
        	language: {
			        "sProcessing": "处理中...",
			        "sLengthMenu": "显示 _MENU_ 项结果",
			        "sZeroRecords": "没有匹配结果",
			        "sInfo": "显示第 _START_ 至 _END_ 项结果，共 _TOTAL_ 项",
			        "sInfoEmpty": "显示第 0 至 0 项结果，共 0 项",
			        "sInfoFiltered": " ",
			        "sInfoPostFix": "",
			        "sSearch": "搜索:",
			        "sUrl": "",
			        "sEmptyTable": "表中数据为空",
			        "sLoadingRecords": "载入中...",
			        "sInfoThousands": ",",
			        "oPaginate": {
			            "sFirst": "首页",
			            "sPrevious": "上页",
			            "sNext": "下页",
			            "sLast": "末页"
			        },
			        "oAria": {
			            "sSortAscending": ": 以升序排列此列",
			            "sSortDescending": ": 以降序排列此列"
			        }
		   		},
            "iDisplayLength" : 10,
            "paging": true,
            "lengthChange": true,
            "bSort" : false,
            "processing" : true,
            "serverSide" : true,
            "searching": false,
            "ordering": false,
            "autoWidth": false,
            "ajax":{
            	 "url":"${path}<%=StatisticaController.URL_RANGE_SEARCH%>?&"+arr[arr.length-1],
            	 "type":"post",
            },
            "columns":[
            		{ "data": "day",
            		  "title":"日期",
            		  "defaultContent":"无",	
            		 },
            		 { "data": "visaCount",
            		  "title":"送签数量",
            		  "defaultContent":"无",	
            		 },
             		{ "data": "successCount","title":"成功数量","defaultContent":""},
             		{ "data": "failCount","title":"失败数量","defaultContent":""},
             		{ "data": "canselCount","title":"取消数量","defaultContent":"" },
            ]
        });
    }
        //月报
        $("#searchMonth").click(function () {
        getmonthData();
        });
        $("#searchRangeDays").click(function(){
        	var param = {
		        "startDate": $('#startDate').val(),
		        "endDate": $('#endDate').val()
	    	};
	    	table.settings()[0].ajax.data = param;
       		table.ajax.reload();
        });
</script>
</body>
</html>